Skip to content

[Toolbar] Hover style and Toggle State [ATL-1107][ATL-1045] #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 10, 2021

Conversation

fstasi
Copy link
Contributor

@fstasi fstasi commented Mar 9, 2021

Why

  • We are missing hover and pressed state on the buttons, which can be confusing to users switching from Java IDE.
  • The Java IDE has the buttons remain “activated” until an operation is carried out.
  • We want the "Verify" and "Upload" buttons (and menu items) to be disabled while the corresponding operation is in progress.

How

  • added "hover" behavior to all toolbar items, via CSS rule
  • added "toggle" state to arduino toolbar buttons, by adding a prop, binded to the relative registry command. The isToggled function of the registry command was previously not called by Toolbar Items. I adopted the same mechanism used for isEnabled.
  • set isToggled/isEnabled using an internal state updated by the verify and upload functions

Other

Jira Task (cosmetics)
Jira Task (disable while in progress)
Fixes #173

@fstasi fstasi requested a review from kittaakos March 9, 2021 15:38
@fstasi fstasi changed the title [Toolbar] Hover style and Toggle State [ATL-1107] [Toolbar] Hover style and Toggle State [ATL-1107][ATL-1045] Mar 9, 2021
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks promising 👍 I added a few remarks. Also, please squash your commits; we need one single commit for the PR. Thank you!

@@ -65,7 +71,17 @@ export class VerifySketch extends SketchContribution {
}

async verifySketch(exportBinaries?: boolean): Promise<void> {

// even with buttons disabled, better to double check if a verify is already in progress
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to double check

Why? This code should not run if isEnabled is implemented correctly for the command handler. Did you experience a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this check in order to future-proof the verify-sketch implementation:

https://arduino.atlassian.net/browse/ATL-1045 reports an error (Error: Request upload failed with message: 2 UNKNOWN: exit status 1) when a verify/build is run while another is in progress.

At the moment we only have buttons/menu items, but the check whether or not continue with the action should be inside the action handler itself in my opinion..

Do you have concerns about this approach?

@@ -18,15 +18,21 @@ export class VerifySketch extends SketchContribution {
@inject(BoardsServiceProvider)
protected readonly boardsServiceClientImpl: BoardsServiceProvider;

verifyInProgress = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a protected field, not a public mutable property. Same for the upload part.

.p-TabBar-toolbar .item.arduino-tool-item > div:hover {
background: (--theia-arduino-toolbar-hoverBackground);
.p-TabBar-toolbar .item.arduino-tool-item:hover > div {
background: white;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use hard-coded color so neither white nor rgb(255,204,0) is acceptable. We use VS Code themes, any new colors we want to use have to be derived from the available theme colors.

Here is the Theia doc: https://github.com/eclipse-theia/theia/pull/6475/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed

@fstasi
Copy link
Contributor Author

fstasi commented Mar 10, 2021

It looks promising 👍 I added a few remarks. Also, please squash your commits; we need one single commit for the PR. Thank you!

Is that ok to squash merge the PR in order to have a single commit on master? Or do you mean you want a single commit in the PR?

@fstasi fstasi merged commit cf3445a into main Mar 10, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 29, 2021
@per1234 per1234 added the topic: theme Related to GUI theming label Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: theme Related to GUI theming
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify and Upload buttons do not change colour when activated.
3 participants